package com.whcoding.easypoi.controller;

import com.whcoding.easypoi.service.PoiExcelService;
import com.whcoding.easypoi.util.LocalJsonUtil;
import com.whcoding.easypoi.vo.OrmDeptVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.DataFormat;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.xssf.streaming.SXSSFCell;
import org.apache.poi.xssf.streaming.SXSSFRow;
import org.apache.poi.xssf.streaming.SXSSFSheet;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.math.BigDecimal;
import java.net.URLEncoder;
import java.util.List;

/**
 * @program: spring-boot-learning
 * @description:
 * @author: whcoding
 * @create: 2022-09-08 14:55
 **/
@RequestMapping("/poiExcel")
@RestController
@Api(tags = "PoiExcelController", description = "Poi导入导出测试")
public class PoiExcelController {

	@Autowired
	PoiExcelService poiExcelService;

	/**
	 * http://localhost:3088/poiExcel/exportByCrt
	 * <p>
	 * POI 导出手工
	 *
	 * @param response
	 * @throws IOException
	 */
	@RequestMapping(value = "/exportByCrt", method = RequestMethod.GET)
	private void exportByCrt(HttpServletResponse response) throws IOException {
		poiExcelService.exportByCrt(response);
	}


	/**
	 * 导出Dept 明细数据
	 *
	 * @param response
	 * @param costBillParamVo
	 */
	@PostMapping("/exportDeptDetail")
	@ApiOperation(value = "")
	public void exportDeptDetail(HttpServletResponse response, @RequestBody(required = false) OrmDeptVO
			costBillParamVo) {
		poiExcelService.exportDeptDetail(response, costBillParamVo);
	}

}
